import React from 'react'
import { Switch, Route, Redirect } from 'react-router-dom';
import List from './List'
import Add from './Add'
import Edit from './Edit'

function Index(props) {
  const baseUrl = props.match.path;
  return (
    <div>
      <Switch>
        <Route path={baseUrl + "/list"} component={List} />
        <Route path={baseUrl + "/add"} component={Add} />
        <Route path={baseUrl + "/edit/:id"} component={Edit} />
        <Redirect exact from={baseUrl} to={baseUrl + '/list'} />
        <Route path={baseUrl + "/404"} render={() => <div>您访问的页面不存在</div>}></Route>
        <Redirect from={baseUrl + "/*"} to={baseUrl + "/404"} ></Redirect>
      </Switch>
    </div>
  )
}
export default Index;